Fix duplicate output on console resize event #806
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Summary
Fix the long-known issue of duplicate output.
PR Context
When a console resize event is received, the event handler sets
errnotoEINTR, which falsely causes a concurrently pending write operation to be considered failed and retried. This results in duplicate console output, as well as duplicate application requests. This duplication can lead to an infinite loop, since a duplicate request generates another console resize event, which triggers another duplicate request. This can occur, for example, when terminals generate a resize event when an application requests a switch between alternate/normal buffer mode.Fixes PowerShell/Win32-OpenSSH#2275 and most of related issues.
Related to:
watchcommand doesn't work properly microsoft/terminal#8869